package com.wq.code;

/**
 * @Author: wangqiang20995
 * @Date:19-2-17
 * @Description:
 * @Resource:
 */
public class TwoNumberSum {

    public int[] twoSum(int[] nums, int target) {
        int i = nums.length - 1;

        int start = 0, end = 0;
        boolean flag = false;
        int[] index = new int[2];
        for (start = 0; start <= i; start++) {
            for (end = start + 1; end <= i; end++) {
                if ((nums[start] + nums[end]) == target) {
                    index[0] = start;
                    index[1] = end;
                    flag = true;
                }
            }

            if (flag) {
                break;
            }
        }


        return index;
    }

    public static void main(String args[]) {
        TwoNumberSum twoNumberSum = new TwoNumberSum();
        int[] ary = twoNumberSum.twoSum(new int[]{0, 3, 7, 13, 4}, 3);
        System.out.println(ary[0] + "|" + ary[1]);
    }
}
